<?php

/**
 * BolaoAlbum form.
 *
 * @package    bolao-aabb
 * @subpackage form
 * @author     Your name here
 */
class BolaoAlbumForm extends BaseBolaoAlbumForm
{
  protected
    $albums = null;

  public function __construct($albums = array(), $object = null, $options = array(), $CSRFSecret = null)
  {
    $this->albums = $albums;

    parent::__construct($object, $options, $CSRFSecret);
  }

  public function configure()
  {
    $this->widgetSchema['picasa_id'] = new sfWidgetFormPicasaAlbum(array(
      'albums' => $this->albums,
    ));
    $this->widgetSchema['picasa_id']->setLabel('&Aacute;lbums dispon&iacute;veis:');

    $albums_IDs = array();
    foreach ($this->albums as $album) $albums_IDs[] = $album->getIdnum();
    $this->validatorSchema['picasa_id'] = new sfValidatorChoice(array(
      'choices' => $albums_IDs,
    ), array(
      'invalid' => '&Aacute;lbum inv&aacute;lido.',
    ));

    $this->widgetSchema['send_email'] = new sfWidgetFormInputCheckbox(array(
      'label' => 'Enviar e-mail?'
    ));
    $this->validatorSchema['send_email'] = new sfValidatorBoolean();
  }
}
